package communication;

import jade.core.AID;
import jade.util.leap.Serializable;

import java.util.Date;

public class Message implements Serializable {
	
	protected String text = null;
	protected AID aid;
	protected MessageType type;
	protected Date date;
	
	
	/** Obrazek */
	byte[] imageInByte;
	//protected transient BufferedImage image;
		
	public Message(AID aid) {
		this.aid = aid;
		type = MessageType.MESSAGE;
		this.date = new Date();
		//image = null;
	}
	
	public Message(AID aid, MessageType type) {
		this.aid = aid;
		this.type = type;
		//image = null;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
	
	public AID getAid() {
		return aid;
	}
	
	public void setAid(AID aid) {
		this.aid = aid;
	}
	
	public MessageType getType() {
		return type;
	}
	
	public void setType(MessageType type) {
		this.type = type;
	}
	
	public byte[] getImage() {
		return imageInByte;
	}

	public void setImage(byte[] image) {
		this.imageInByte = image;
	}
//	
//	private void writeObject(ObjectOutputStream out) throws IOException {
//		out.defaultWriteObject();
//		if (this.image != null) {
//			out.writeBoolean(true);
//			ImageIO.write(image, "png", out);
//		} else
//			out.writeBoolean(false);
//
//	}
//
//	private void readObject(ObjectInputStream in) throws IOException,
//			ClassNotFoundException {
//		in.defaultReadObject();
//		if (in.readBoolean())
//			image = (ImageIO.read(in));
//
//	}
	
	

}
